package com.example.WebSocketDemo.service.impl;

import com.example.WebSocketDemo.bean.Friend;
import com.example.WebSocketDemo.bean.FriendRequest;
import com.example.WebSocketDemo.mapper.FriendRequestMapper;
import com.example.WebSocketDemo.service.FriendRequestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service("friendRequestService")
public class FriendRequestImpl implements FriendRequestService {
    @Autowired
    private FriendRequestMapper friendRequestMapper;
    @Override
    public List<FriendRequest> getFriendRequestByUsername(String username) {
        return friendRequestMapper.getFriendRequestByUsername(username);
    }

    @Override
    public void rejectRequest(String id) {
        friendRequestMapper.rejectRequest(id);
    }

    @Override
    public void agreeRequest(String id) {
        friendRequestMapper.agreeRequest(id);
    }

    @Override
    public void addFriend(Friend friendRequest) {
       // System.out.println(friendRequest);
        friendRequestMapper.addFriend(friendRequest);
    }

    @Override
    public void userDontLine(String username, String friendName) {
        friendRequestMapper.userDontLine(username,friendName);
    }

    @Override
    public List<FriendRequest> getUnAcceptedRequest(String username) {
        return friendRequestMapper.getUnAcceptedRequest(username);
    }

    @Override
    public void changeRequestAccepted(String username) {
        friendRequestMapper.changeRequestAccepted(username);
    }
}
